package cn.ethan.demo.design.factory.impl;

import cn.ethan.demo.design.factory.CacheAdapter;
import cn.ethan.demo.design.matter.EGM;

import java.util.concurrent.TimeUnit;

/**
 * @author 张俊辉
 */

public class EGMCacheAdapter implements CacheAdapter {
    private EGM egm = new EGM();

    public String get(String key) {
        return egm.gain(key);
    }

    public void set(String key, String value) {
        egm.set(key, value);
    }

    public void set(String key, String value, long timeout, TimeUnit timeUnit) {
        egm.setEx(key, value, timeout, timeUnit);
    }

    public void del(String key) {
        egm.delete(key);
    }
}
